<?
  $conn = @mysql_connect("localhost:8889","root","root") or die ("Connection failed!");
  mysql_select_db("uniport",$conn);
?>
<html>
<head>
</head>
<body>
<h1>UniPort User List</h1>
  <div>
    <form id='searchform' action='index.php' method='get'>
      Search after email address, without keyword, all the users will be listed.
      <input id='search' name='search' type='text' size='20' value='<?php echo $_GET['search']; ?>' />
      <input id='submit' type='submit' value='Los!' />
    </form>
  </div>
<?
 
  if (isset($_GET['search'])) {
    $sql = "SELECT * FROM user WHERE email like '%" . $_GET['search'] . "%'";
  } else {
    $sql = "SELECT * FROM user";
  }


  $query = mysql_query($sql,$conn);
?>
  <table style='border: 2px solid black'>
    <thead style='background: black'>
      <tr style='color:white'>
        <td> E-mail </td>
		<td> First Name </td>
		<td> Last Namel </td>
		<td> Birthday </td>
		<td> Password </td>
		<td> Univercity </td>
		<td> Major </td>
		<td> PictureID </td>
      </tr>
    </thead>
    <tbody>
<?
  
  while ($row = mysql_fetch_array($query)) {
   echo "<tr>";
    echo "<td>" . $row[email] . "</td>";
	echo "<td>" . $row[f_name] . "</td>";
	echo "<td>" . $row[l_name] . "</td>";
	echo "<td>" . $row[d_birth] . "</td>";
	echo "<td>" . $row[u_password] . "</td>";
	echo "<td>" . $row[uni] . "</td>";
	echo "<td>" . $row[major] . "</td>";
	echo "<td>" . $row[pic_id] . "</td>";
    echo "</tr>";
  }
?>
    </tbody>
  </table>
  <br>
  <div>Totally <?=mysql_num_rows($query)?> user founded</div>
</body>
</html>
